/*
 * Copyright (c) 2008 VMware, Inc.
 * Copyright (c) 2009 John Pritchard, WTKX Project Group
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package wtkx.in;

import wtkx.collections.ArrayList;
import wtkx.collections.HashMap;
import wtkx.io.FileList;
import wtkx.wtk.Manifest;
import wtkx.wtk.media.Image;
import wtkx.wtk.media.Picture;

import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.net.URL;

/**
 * Manifest class that serves as data source for a clipboard or drag/drop
 * operation.
 *
 * @author gbrown
 */
public class LocalManifest
    extends Object
    implements Manifest 
{
    protected String text = null;
    protected Image image = null;
    protected FileList fileList = null;
    protected URL url = null;
    protected HashMap<String, Object> values = new HashMap<String, Object>();

    public String getText() {
        return text;
    }

    public void putText(String text) {
        if (text == null) {
            throw new IllegalArgumentException("text is null.");
        }

        this.text = text;
    }

    public boolean containsText() {
        return (text != null);
    }

    public Image getImage() {
        return image;
    }

    public void putImage(Image image) {
        if (image == null) {
            throw new IllegalArgumentException("image is null.");
        }

        this.image = image;
    }

    public boolean containsImage() {
        return image != null;
    }

    public FileList getFileList() {
        return fileList;
    }

    public void putFileList(FileList fileList) {
        if (fileList == null) {
            throw new IllegalArgumentException("fileList is null.");
        }

        this.fileList = fileList;
    }

    public boolean containsFileList() {
        return fileList != null;
    }

    public URL getURL() {
        return url;
    }

    public void putURL(URL url) {
        if (url == null) {
            throw new IllegalArgumentException("url is null.");
        }

        this.url = url;
    }

    public boolean containsURL() {
        return url != null;
    }

    public Object getValue(String key) {
        return values.get(key);
    }

    public Object putValue(String key, Object value) {
        return values.put(key, value);
    }

    public boolean containsValue(String key) {
        return values.containsKey(key);
    }
}
